Feature (Module): Add BetterFirework Module#154
Conversation
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
| private fun SafeContext.getFireworkAtHotbar(): Int { | ||
| for (i in 0..8) { | ||
| val itemStack: ItemStack = player.getInventory().getStack(i) | ||
| if (itemStack.item !== Items.FIREWORK_ROCKET) continue | ||
| return i | ||
| } | ||
| return -1 | ||
| } | ||
|
|
||
| private fun SafeContext.getFireworkInInventoryScreen(): Int { | ||
| val screenHandler: PlayerScreenHandler = player.playerScreenHandler | ||
| for (i in PlayerScreenHandler.INVENTORY_START..<PlayerScreenHandler.INVENTORY_END) { | ||
| val itemStack = screenHandler.getSlot(i).stack | ||
| if (itemStack.item !== Items.FIREWORK_ROCKET) continue | ||
| return i | ||
| } | ||
| return -1 | ||
| } |
There was a problem hiding this comment.
We have utils to find and swap items
There was a problem hiding this comment.
I could not find any utils that tell me what inventory index the found items are in. We looked at this like 3 weeks ago. You couldn't find any either.
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
cfc96c2 to
c1b167e
Compare
|
@Edouard127 so we merge? |
beanbag44
left a comment
There was a problem hiding this comment.
just small things. Also, for single line if blocks, its often cleaner to omit the braces and keep them on the same line or at least the action after the check. Like this:
if (something) doSomething()
else if (something else) doSomethingElse()
| tag = ModuleTag.MOVEMENT, | ||
| ) { | ||
| private var fireworkInteract by setting("Firework Interact", true, "Automatically start flying when right clicking fireworks") | ||
| private var fireworkInteractCancel by setting("Firework Interact Cancel", false, "Cancel block interactions while holding fireworks") { fireworkInteract } |
There was a problem hiding this comment.
Its annoying sometimes when you fly into a wall and try to use a firework for it to spam it on a block. Maybe this could be a general setting rather than an extension of fireworkInteract
There was a problem hiding this comment.
You can just enable the Module
| description = "Automatic takeoff with fireworks", | ||
| tag = ModuleTag.MOVEMENT, | ||
| ) { | ||
| private var fireworkInteract by setting("Firework Interact", true, "Automatically start flying when right clicking fireworks") |
There was a problem hiding this comment.
I would have used the name "Right Click Fly" instead of "Firework Interact"
| interaction.clickSlot(player.playerScreenHandler.syncId, swap, 0, SlotActionType.SWAP, mc.player) | ||
|
|
||
| if (player.getInventory().selectedSlot != 0) { | ||
| player.networkHandler.sendPacket(UpdateSelectedSlotC2SPacket(0)) |
There was a problem hiding this comment.
this should request the hotbar manager with keep ticks set to 0 for silent swap
| enum class TakeoffState { | ||
| NONE, | ||
| JUMPING, | ||
| START_FLYING |
There was a problem hiding this comment.
these should be in camel case
daebacd to
e76fb57
Compare
beanbag44
left a comment
There was a problem hiding this comment.
just one thing, aside from that i think its good
| tag = ModuleTag.MOVEMENT, | ||
| ) { | ||
| private var fireworkInteract by setting("Right Click Fly", true, "Automatically start flying when right clicking fireworks").group(Group.General) | ||
| private var fireworkInteractCancel by setting("Right Click Cancel", false, "Cancel block interactions while holding fireworks") { fireworkInteract }.group(Group.General) |
There was a problem hiding this comment.
i meant that this shouldn't be dependent on right click fly to be a feature. This should be its own option, separate from firework interact
ec590d4 to
99a3940
Compare
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
|
@emyfops you approve? |
Set default options that actually work
This Module adds better Fireworks utility. Features include: